subroutine disp( ijob )
use molecule
implicit none
   !----------------------------------------------------------------------------
   integer, intent(in) :: ijob
   !----------------------------------------------------------------------------
   character (len=100) :: fmtstr, fmtstr2
   integer             :: i,j,k,l, idum, istr, iend
   !----------------------------------------------------------------------------
   select case (ijob)
   case ( 0 ) ! general info
      write(*, '(//,10x,"For your selected molecule: ", A, ", there are")') trim(molname)
      fmtstr = '(12x,I??," atoms     with ", I??, " atom types,")'
      write(fmtstr(7:8),  '(I2)') int(log10(dble(natom)+0.1)) + 1
      write(fmtstr(31:32),'(I2)') int(log10(dble(natomtype)+0.1)) + 1
      write(*, fmtstr) natom, natomtype
      fmtstr = '(12x,I??," bonds     with ", I??, " bond types,")'
      write(fmtstr(7:8),  '(I2)') int(log10(dble(nbond)+0.1)) + 1
      write(fmtstr(31:32),'(I2)') int(log10(dble(nbondtype)+0.1)) + 1
      write(*, fmtstr) nbond, nbondtype
      fmtstr = '(12x,I??," angles    with ", I??, " angle types,")'
      write(fmtstr(7:8),  '(I2)') int(log10(dble(nangle)+0.1)) + 1
      write(fmtstr(31:32),'(I2)') int(log10(dble(nangletype)+0.1)) + 1
      write(*, fmtstr) nangle, nangletype
      fmtstr = '(12x,I??," dihedrals with ", I??, " dihedral types")'
      write(fmtstr(7:8),  '(I2)') int(log10(dble(ndihed)+0.1)) + 1
      write(fmtstr(31:32),'(I2)') int(log10(dble(ndihedtype)+0.1)) + 1
      write(*, fmtstr) ndihed, ndihedtype
      write(*, '(12x,"Total charge on molecule:", F10.6, /)') sum(chg)
   case ( 1 ) ! atom
      write(*,'(//,10x,"For your selected molecule: ", A, ", there are")') trim(molname)
      fmtstr = '(12x,I??," atoms     with ", I??, " atom types.")'
      write(fmtstr(7:8),  '(I2)') int(log10(dble(natom)+0.1)) + 1
      write(fmtstr(31:32),'(I2)') int(log10(dble(natomtype)+0.1)) + 1
      write(*, fmtstr) natom, natomtype
      !
      if ( natomtype.gt.0 ) then
         idum = int(log10(dble(natomtype)+0.1D0)) + 3
         idum = max(3,idum)
         fmtstr = '(A??,$)'
         write(fmtstr(3:4),'(I2)') idum
         fmtstr2 = '(I??,$)'
         write(fmtstr2(3:4),'(I2)') idum
         !
         write(*,'(/,10x,"Type index: ", $)')
         do i = 1, natomtype
            write(*,fmtstr2) i
         enddo
         write(*,'(/,10x,"Atom type : ",$)')
         do i = 1, natomtype
            write(*,fmtstr) trim(typename(i))
         enddo
         write(*,'(/,10x,"Type ID   : ",$)')
         do i = 1, natomtype
            write(*,fmtstr2) typeid(i)
         enddo
         write(*,'(/)')
      endif
   case ( 2 ) ! bond
      write(*,'(//,10x,"For your selected molecule: ", A, ", there are")') trim(molname)
      fmtstr = '(12x,I??," bonds     with ", I??, " bond types.")'
      write(fmtstr(7:8),  '(I2)') int(log10(dble(nbond)+0.1)) + 1
      write(fmtstr(31:32),'(I2)') int(log10(dble(nbondtype)+0.1)) + 1
      write(*, fmtstr) nbond, nbondtype
      !
      if ( nbondtype.gt.0 ) then
         write(*, '(10x,"The bond types and their corresponding bond IDs are: ")')
         fmtstr  = '(A2,"-",A2,"  ",$)'
         fmtstr2 = '(15(I5,"  "))'
         !
         idum = (nbondtype-1)/15+1
         do i = 1, idum
            istr = (i-1)*15+1
            iend = min(nbondtype, istr+14)
            write(*,'(/,12x,"Index: ",$)')
            write(*,fmtstr2) (j, j=istr,iend)
            write(*,'(12x,  "Type : ",$)')
            do j = istr, iend
               write(*, fmtstr) bondname(1, j), bondname(2,j)
            enddo
            write(*,'(/,12x,"IDs  : ",$)')
            write(*,fmtstr2) bondid(istr:iend)
         enddo
      endif
   case ( 3 ) ! angle
      write(*,'(//,10x,"For your selected molecule: ", A, ", there are")') trim(molname)
      fmtstr = '(12x,I??," angles    with ", I??, " angle types.")'
      write(fmtstr(7:8),  '(I2)') int(log10(dble(nangle)+0.1)) + 1
      write(fmtstr(31:32),'(I2)') int(log10(dble(nangletype)+0.1)) + 1
      write(*, fmtstr) nangle, nangletype
      !
      if ( nangletype.gt.0 ) then
         write(*, '(10x,"The angle types and their corresponding type IDs are: ")')
         fmtstr  = '(A2,"-",A2,"-",A2,"  ",$)'
         fmtstr2 = '(10(I8,"  "))'
         !
         idum = (nangletype-1)/10+1
         do i = 1, idum
            istr = (i-1)*10+1
            iend = min(nangletype, istr+9)
            write(*,'(/,12x,"Index: ", $)')
            write(*,fmtstr2) (j, j=istr,iend)
            write(*,'(12x,"Type : ",$)')
            do j = istr, iend
               write(*, fmtstr) anglename(1:3, j)
            enddo
            write(*,'(/,12x,"IDs  : ",$)')
            write(*,fmtstr2) angleid(istr:iend)
         enddo
      endif
   case ( 4 ) ! dihedrals
      write(*,'(//,10x,"For your selected molecule: ", A, ", there are")') trim(molname)
      fmtstr = '(12x,I??," dihedrals with ", I??, " dihedral types.")'
      write(fmtstr(7:8),  '(I2)') int(log10(dble(ndihed)+0.1)) + 1
      write(fmtstr(31:32),'(I2)') int(log10(dble(ndihedtype)+0.1)) + 1
      write(*, fmtstr) ndihed, ndihedtype
      !
      if ( ndihedtype.gt.0 ) then
         write(*, '(10x,"The dihedral types and their corresponding type IDs are: ")')
         fmtstr  = '(A2,"-",A2,"-",A2,"-",A2,"  ",$)'
         fmtstr2 = '(8(I11,"  "))'
         !
         idum = (ndihedtype-1)/8+1
         do i = 1, idum
            istr = (i-1)*8+1
            iend = min(ndihedtype, istr+7)
            write(*,'(/,12x,"Index: ", $)')
            write(*,fmtstr2) (j, j=istr,iend)
            write(*,'(12x,"Type : ",$)')
            do j = istr, iend
               write(*, fmtstr) dihedname(1:4, j)
            enddo
            write(*,'(/,12x,"IDs  : ",$)')
            write(*,fmtstr2) dihedid(istr:iend)
         enddo
      endif
   end select
   !
return
end subroutine
